package com.edu.study.base.questionKind.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.SecurityUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.edu.study.base.questionKind.mapper.StuQuestionKindMapper;
import com.edu.study.base.questionKind.domain.StuQuestionKind;
import com.edu.study.base.questionKind.service.IStuQuestionKindService;

/**
 * 题型分类Service业务层处理
 * 
 * @author jjt
 * @date 2021-05-17
 */
@Service
//@DataSource(value = DataSourceType.SLAVE)
public class StuQuestionKindServiceImpl implements IStuQuestionKindService 
{
    @Autowired
    private StuQuestionKindMapper stuQuestionKindMapper;

    /**
     * 查询题型分类
     * 
     * @param id 题型分类ID
     * @return 题型分类
     */
    @Override
    public StuQuestionKind selectStuQuestionKindById(Long id)
    {
        return stuQuestionKindMapper.selectStuQuestionKindById(id);
    }

    /**
     * 查询题型分类列表
     * 
     * @param stuQuestionKind 题型分类
     * @return 题型分类
     */
    @Override
    public List<StuQuestionKind> selectStuQuestionKindList(StuQuestionKind stuQuestionKind)
    {
        return stuQuestionKindMapper.selectStuQuestionKindList(stuQuestionKind);
    }

    /**
     * 新增题型分类
     * 
     * @param stuQuestionKind 题型分类
     * @return 结果
     */
    @Override
    public int insertStuQuestionKind(StuQuestionKind stuQuestionKind)
    {
        stuQuestionKind.setCreateDate(new Date());
        stuQuestionKind.setUpdateDate(new Date());
        stuQuestionKind.setUpdateBy(SecurityUtils.getUserId().toString());
        stuQuestionKind.setCreateBy(SecurityUtils.getUserId().toString());
        stuQuestionKind.setDelFlag("0");
        return stuQuestionKindMapper.insertStuQuestionKind(stuQuestionKind);
    }

    /**
     * 修改题型分类
     * 
     * @param stuQuestionKind 题型分类
     * @return 结果
     */
    @Override
    public int updateStuQuestionKind(StuQuestionKind stuQuestionKind)
    {   stuQuestionKind.setUpdateDate(new Date());
        stuQuestionKind.setUpdateBy(SecurityUtils.getUserId().toString());
        return stuQuestionKindMapper.updateStuQuestionKind(stuQuestionKind);
    }

    /**
     * 批量删除题型分类
     * 
     * @param ids 需要删除的题型分类ID
     * @return 结果
     */
    @Override
    public int deleteStuQuestionKindByIds(Long[] ids)
    {
        return stuQuestionKindMapper.deleteStuQuestionKindByIds(ids);
    }

    /**
     * 删除题型分类信息
     * 
     * @param id 题型分类ID
     * @return 结果
     */
    @Override
    public int deleteStuQuestionKindById(Long id)
    {
        return stuQuestionKindMapper.deleteStuQuestionKindById(id);
    }

    @Override
    public List<StuQuestionKind> getQuestionKindByCatalogId(Long catalogId) {
        return stuQuestionKindMapper.getQuestionKindByCatalogId(catalogId);
    }

    @Override
    public List<StuQuestionKind> selectStuQuestionKindListByIds(List<Long> questionTypeIds) {
        return stuQuestionKindMapper.selectStuQuestionKindListByIds(questionTypeIds);
    }
}
